package com.project_doctor.mapper;

import com.project_doctor.pojo.Tag;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
* @author xixif
* @description 针对表【t_tag(统一标签表)】的数据库操作Mapper
* @createDate 2025-06-03 16:14:13
* @Entity com.project_doctor.pojo.Tag
*/
public interface TagMapper extends BaseMapper<Tag> {
    @Select("select DISTINCT(`name`) from t_tag where ref_type = 1")
    List<Tag> selectAllTag(Integer type);

    void insertBatch(@Param("list") List<Tag> tags);

    @Select("SELECT name, COUNT(*) as count FROM t_tag WHERE ref_type = 1 GROUP BY name ORDER BY count DESC LIMIT 6")
    List<Map<String, Object>> getTagStatistics();

    @Select("SELECT DISTINCT name  FROM t_tag WHERE ref_type = 1")
    List<Tag> getTagStatus();
}




